<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="common/head.jsp"%>
<div class="right_col" role="main">
	<br /> <br /> <br /> <br /> <br />
	<div class="container">
		<br /> <br /> <br /> <br /> <input type="button"
			style="height: 30px; float: left; width: 110px;"
			class="btn btn-danger insFunsType" value="增加趣事类型" /> <br /> <br />
		<br />
		<table class="display" id="example">
			<thead>
				<tr align="center">
					<th>类型编号</th>
					<th>类型名称</th>
					<th>相关操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${funsTypeList}" var="funsTypeList">
					<tr align="center">
						<td>${funsTypeList.sequnce}</td>
						<td>${funsTypeList.type}</td>
						<td>
							<div class="btn-group">
								<button style="height: 30px" type="button"
									class="btn btn-danger">操作</button>
								<button style="height: 30px" type="button"
									class="btn btn-danger dropdown-toggle" data-toggle="dropdown"
									aria-expanded="false">
									<span class="caret"></span> <span class="sr-only">Toggle
										Dropdown</span>
								</button>
								<ul class="dropdown-menu" role="menu">
									<li><a
										href="<%=basePath%>funsType/getFunsType?id=${funsTypeList.id}"
										class="charge">修改</a></li>
									<li><a href="javascript:;"
										funsTypeId="${funsTypeList.id }" class="delFunsType">删除</a></li>
								</ul>
							</div>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>
</div>
<script>
$(document).ready(function() {
	//趣事类型删除
    $(".delFunsType").click(function() {
        var obj = $(this);
        var funsTypeId = obj.attr("funsTypeId");
            if (confirm("真的要删除它吗?")) {
                $.ajax({
                    type: "GET",
                    url: "<%=basePath%>funsType/delFunsType",
                    data: {
                        "funsTypeId": funsTypeId,
                    },
                    dataType: "json",
                    success: function(data) {
                        if (data.result == "true") {
                            alert("亲,恭喜您删除成功了");
                            window.location.href = "<%=basePath%>funsType/showFunsType";
																} else if (data.result == "false") {
																	alert("对不起，删除失败了");
																}
															},
															error : function(
																	data) {
																alert("对不起，删除失败了");
															}
														});
											}
										});
  //趣事类型添加
    $(".insFunsType").click(function() {
    	window.location.href = "<%=basePath%>funsType/goFunsType";
										});
					});
</script>
<!--dataTables-->
<script charset="utf-8" type="text/javascript">
	$(document).ready(function() {
		$('#example').dataTable();
	});
</script>
<script type="text/javascript">
	$('#example').removeClass('display').addClass('table table-striped table-bordered');
</script>
<!--dataTables-->
<%@ include file="common/foot.jsp"%>